<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态绑定内联样式——对象语法</title>
</head>
<body>
<div id="app">
    <h1 v-bind:style="myStyle">Hello, Vue!</h1>
    <h1 v-bind:style="myColor">Hello, Vue!</h1>
    <!--<h1 v-bind:style="style">Hello, Vue!</h1>-->

</div>

<script type="module">
    import {createApp, ref, reactive} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let size = ref(64)
                let myStyle = reactive({
                    fontSize: size.value + 'px'
                })

                let color = ref("red")
                let myColor = reactive({
                    backgroundColor: color
                })

                let style = reactive({
                    fontSize: size.value + 'px',
                    backgroundColor: color
                })

                return {
                    size,
                    myStyle,
                    color,
                    myColor,
                    style,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>